

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div class="container col-md-4 pt-5">
    <h2 class="text-muted">修改书籍</h2>
    <form action="${pageContext.request.contextPath}/book/UpdateBook" class="was-validated"  method="post">
        <div class="form-group">
            <label for="disabledTextInput">书籍编号:</label>
            <input type="text" class="form-control" id="disabledTextInput"  name="bookID" value="${book.bookID}" readonly="readonly">
            <div class="invalid-feedback">请输入书籍编号！</div>
        </div>
        <div class="form-group">
            <label for="name">书籍名称:</label>
            <input type="text" class="form-control" id="name" placeholder="${book.bookName}" name="bookName" required>
            <div class="invalid-feedback">请输入书籍名称！</div>
        </div>
        <div class="form-group">
            <label for="count">数量:</label>
            <input type="text" class="form-control" id="count"  placeholder="${book.bookCounts}" name="bookCounts" required>
            <div class="invalid-feedback">请输入数量！</div>
        </div>
        <div class="form-group">
            <label for="detail">详情:</label>
            <input type="text" class="form-control" id="detail" placeholder="${book.detail}" name="detail" required>
            <div class="invalid-feedback">请输入详情！</div>
        </div>
        <button type="submit" class="btn btn-primary">修改</button>
<%--        <div class="valid-feedback">成功！</div>--%>
    </form>
</div>
<%--<script>--%>
<%--    // 如果验证不通过禁止提交表单--%>
<%--    (function() {--%>
<%--        'use strict';--%>
<%--        window.addEventListener('load', function() {--%>
<%--            // 获取表单验证样式--%>
<%--            let forms = document.getElementsByClassName('needs-validation');--%>
<%--            // 循环并禁止提交--%>
<%--            let temp=Array.prototype.filter.call(forms, function (form) {--%>
<%--                form.addEventListener('submit', function (event) {--%>
<%--                    if (form.checkValidity() === false) {--%>
<%--                        event.preventDefault();--%>
<%--                        event.stopPropagation();--%>
<%--                    }--%>
<%--                    form.classList.add('was-validated');--%>
<%--                },false);--%>
<%--            });--%>
<%--        }, false);--%>
<%--    })();--%>
<%--</script>--%>
</body>
</html>
